package com.gl.util.property;

import java.io.FileInputStream;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Types;
import java.util.Properties;
import java.util.ResourceBundle;

public class PropertyRead1 {
	private String driver;
	private String url;
	private String user;
	private String pass;
	public void initParam(String paramFile) throws Exception{
		Properties props = new Properties();
		props.load(new FileInputStream(paramFile));
		this.driver = props.getProperty("driver");
		this.url = props.getProperty("url");
		this.user = props.getProperty("user");
		this.pass = props.getProperty("pass");
	}
	
	public void execSql(String sql) throws Exception{
		Class.forName(this.driver);
		Connection conn = DriverManager.getConnection(this.url, this.user, this.pass);
		CallableStatement cstmt = conn.prepareCall("{call add_pro(?,?,?)}");
		{
			cstmt.setInt(1, 4);
			cstmt.setInt(2, 8);
			cstmt.registerOutParameter(3, Types.INTEGER);
			cstmt.execute();
			System.out.println("执行结果是:" + cstmt.getInt(3));
		}
		
	}
	public static void main(String[] args) throws Exception{
		PropertyRead1 pr = new PropertyRead1();
		pr.initParam("src/mysql.properties");
		pr.execSql("select * from UPM_USER");
		
	}

}
